/*
 *  Copyright (C) 2011 Hatsites
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package org.myorg.ctm.etk.gui.swg.display.create.user.panel;

import javax.swing.GroupLayout;
import javax.swing.LayoutStyle;
import org.myorg.shr.gui.swg.display.labelized.LbzHrzPassword;
import org.myorg.shr.gui.swg.display.labelized.LbzTxfHrz;
import org.myorg.shr.gui.swg.display.panel.PnlAbs;

/**
 *
 * @author Hatsites
 *
 * email: Hatsites_AT_gmail.com
 * ... please remove "_AT_" from the above string to get the right email address
 */

public class PnlLoginPassword extends PnlAbs{
    public PnlLoginPassword(){
        this._ltfLogin_ = new LbzTxfHrz("Login",94);
        this._lpfAskPasswd_ = new LbzHrzPassword("Password",63);
        this._lpfConfirmPasswd_ = new LbzHrzPassword("Confirm password",5);
    }

    public boolean init() {
        if(!this._lpfAskPasswd_.init()){
            return false;
        }
        if(!this._lpfConfirmPasswd_.init()){
            return false;
        }
        if(!this._ltfLogin_.init()){
            return false;
        }

        GroupLayout layout = new GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(this._ltfLogin_)
                    .addComponent(this._lpfAskPasswd_)
                    .addComponent(this._lpfConfirmPasswd_)
                )
            )
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(this._ltfLogin_)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(this._lpfAskPasswd_)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(this._lpfConfirmPasswd_)
                )
        );
        return true;
    }

    public void destroy() {
        return;
    }
    public String getLogin(){
        return this._ltfLogin_.getText();
    }
    public String getPassword(){
        return this._lpfAskPasswd_.getText();
    }
    public String getConfirmPassword(){
        return this._lpfConfirmPasswd_.getText();
    }

    private LbzTxfHrz _ltfLogin_;
    private LbzHrzPassword _lpfAskPasswd_;
    private LbzHrzPassword _lpfConfirmPasswd_;
}
